package org.hsqldb.index;

import org.hsqldb.Row;
import org.hsqldb.RowAVLDisk;
import org.hsqldb.lib.IntLookup;
import org.hsqldb.persist.PersistentStore;
import org.hsqldb.rowio.RowOutputInterface;

public class NodeBTreeData extends NodeBTree{
	
	protected final Row row;
	protected NodeBTreeData nodePrev;
	protected NodeBTreeData nodeNext;
    
    NodeBTreeData() {
    	super(null, null);
        row = null;
    }

    public NodeBTreeData(Row r) {
    	super(null, null);
        row = r;
    }

	public void delete() {
		nodePrev = null;
		nodeNext = null;
    }

	


    boolean equals(NodeBTreeData n) {
        return n == this;
    }

    public void setInMemory(boolean in) {}

    public void write(RowOutputInterface out) {}

    public void write(RowOutputInterface out, IntLookup lookup) {}

    public int getPos() {
        return row.getPos();
    }

    protected Row getRow(PersistentStore store) {
        return row;
    }

    protected Object[] getData(PersistentStore store) {
        return row.getData();
    }


    public void updateAccessCount(int count) {}

    public int getAccessCount() {
        return 0;
    }

    public void setStorageSize(int size) {}

    public int getStorageSize() {
        return 0;
    }

    public void setNodeChanged(){
    	
    }
    public void setPos(int pos) {}

    public boolean hasChanged() {
        return false;
    }

    public boolean isKeepInMemory() {
        return false;
    }
    ;

    public boolean keepInMemory(boolean keep) {
        return true;
    }

    public boolean isInMemory() {
        return false;
    }

    public void restore() {}

    public void destroy() {}

    public int getRealSize(RowOutputInterface out) {
        return 0;
    }

    public boolean isMemory() {
        return true;
    }
    /*
    public NodeBTreeData getPreInMemory(){
    	return nodePrev;
    }*/
	public NodeBTreeData getPre(PersistentStore store){
		return nodePrev;
	}
	@Override
	public void setParent(PersistentStore store,NodeBTree parent,int pos){
		nodeParent = parent;
		positionInParent = pos;
		setNodeChanged();
	}
	public NodeBTree getNext(PersistentStore store){
		return nodeNext;
	}
	public void setPre(PersistentStore store,NodeBTreeData data){
		nodePrev = data;
		setNodeChanged();
	}
	public void setNext(PersistentStore store,NodeBTreeData data){
		nodeNext = data;
		setNodeChanged();
	}
}
